package online.sixfish.question.controller;

import online.sixfish.common.api.ApiResult;
import online.sixfish.question.service.UserQuestionRelationShipService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/user/que/relation")
public class UserQuestionRelationShipController {
    @Resource
    UserQuestionRelationShipService userQuestionRelationShipService;

    @GetMapping("/program")
    @PreAuthorize("hasRole('user')")
    public ApiResult getUserQueProgramRelation(){
        Map<Integer, List<Integer>> relation =
                userQuestionRelationShipService.getUserQueProgramRelation();
        return ApiResult.success(relation);
    }
}
